package com.woniuxy.config.rabbitmq;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 马宇航
 * @Description: 定义死信交换机和对应的死信队列
 * @DateTime: 25/10/28/星期二 11:06
 * @Component: 成都蜗牛学苑
 **/
@Configuration
public class DeadMessageConfig {
    @Bean
    public Queue deadLetterQueue() {
        return new Queue("deathQueue");
    }
    @Bean
    public Exchange deadLetterExchange() {
        return new DirectExchange("deathExchange");
    }
    @Bean
    public Binding deadLetterBinding() {
        return BindingBuilder.bind(deadLetterQueue()).to(deadLetterExchange()).with("dead").noargs();
    }
}
